import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter_public/widget/bar/public_app_bar.dart';

/// FileName scaffold_page
///
/// @Author lax
/// @Date 2025/3/10
///
/// @Description

class ScaffoldPage extends StatefulWidget {
  const ScaffoldPage({super.key});

  @override
  State<StatefulWidget> createState() {
    return _ScaffoldPageState();
  }
}

class _ScaffoldPageState extends State<ScaffoldPage> {
  int _bottomNavigationBarIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // 导航栏
      appBar: AppBar(
        title: const Text("App Name"),
        actions: <Widget>[
          //导航栏右侧菜单
          IconButton(
              icon: const Icon(Icons.share),
              onPressed: () {
                log('分享');
              }),
        ],
      ),
      body: Center(
          child: TextButton(
        onPressed: () {
          Navigator.pop(context);
        },
        child: const Text("返回"),
      )),
      // 抽屉
      drawer: const Drawer(),
      // 底部导航栏
      bottomNavigationBar: BottomNavigationBar(
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
          BottomNavigationBarItem(
              icon: Icon(Icons.business), label: 'Business'),
          BottomNavigationBarItem(icon: Icon(Icons.school), label: 'School'),
        ],
        currentIndex: _bottomNavigationBarIndex,
        fixedColor: Colors.blue,
        onTap: (int index) {
          setState(() {
            _bottomNavigationBarIndex = index;
          });
        },
      ),
      // 悬浮按钮
      floatingActionButton: FloatingActionButton(
          child: const Icon(Icons.add),
          onPressed: () {
            log('添加');
          }),
    );
  }
}
